/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package gra.mechanika;

import gra.mechanika.Obiekty.Statek;
import gra.OBJloader.Model_loader;
import gra.Renderer.Renderer;
import gra.Stoper;
import gra.mechanika.stany.ManagerStanow;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;

/**
 *
 * @author Grog
 */
public class Mechanika {

   
    Model_loader model_loader; 
    List<Statek> ListaOBJ;
    Renderer renderer;
    ManagerStanow stany;
    
    public Stoper timer;
    
    
    
    public Mechanika(Renderer renderer) {  
        this.renderer = renderer;
        ListaOBJ = new ArrayList<>();

        timer = new Stoper(); 
        
        
        renderer.ListaOBJ = ListaOBJ;   
    }   
    public void stworzObiekt(String name){
        
        Random r = new Random();
        
        Statek statek = new Statek(name);    
        statek.stworz(0,0,-2); 
        statek.setName(name + " "+r.nextInt(100));
        statek.setSpeed(0.1f);  
        ListaOBJ.add(statek);
        renderer.ListaOBJ.add(statek);
        
        
    }
    public Statek getObiekt(int index){  
       return ListaOBJ.get(index);
       
       
        
    }
    
   

    public void update() {
        timer.Update();
    }
    
    public void zakoncz() {
        ListaOBJ = null;
    }
}
